package it.unical.canonaco.rende.igpe.game.cbv.guilayer.gamemanagermenu.storemenu.charshop;

import it.unical.canonaco.rende.igpe.game.cbv.guilayer.components.ImageCache;
import it.unical.canonaco.rende.igpe.game.cbv.guilayer.gamemanagermenu.storemenu.StorePanel;
import it.unical.canonaco.rende.igpe.game.cbv.guilayer.guievents.GraphicEventManager;
import it.unical.canonaco.rende.igpe.game.cbv.logiclayer.engine.component.pawn.stats.StatsFactory;
import it.unical.canonaco.rende.igpe.game.cbv.logiclayer.engine.managers.StoreManager;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.util.HashMap;

import javax.swing.DefaultListModel;
import javax.swing.JPanel;

public class CharStoreCointainer extends JPanel{

	
	
	public CharStoreCointainer(final GraphicEventManager gem, final StoreManager storeManager, HashMap<String,String> settings,
			 ImageCache imgCache, StatsFactory statsFactory, DefaultListModel charListModel) {
		
		GridBagConstraints gbc = new GridBagConstraints();
		this.setOpaque(false);
		this.setLayout(new GridBagLayout());
		gbc.gridy = 1;
		gbc.anchor = GridBagConstraints.FIRST_LINE_START;
		gbc.insets = new Insets(0,Integer.parseInt(settings.get(StorePanel.INSET_LEFT)),
				Integer.parseInt(settings.get(StorePanel.INSET_BOTTOM)),0);
		this.add(new CharSpellInfoPanel(gem, storeManager, settings, imgCache), gbc);
		
		// This must be added last, cause it fires a SelectedListEvent once it is created
		// so if CharSpellInfoPanel is created after, it would lose the event.
		gbc.gridx = 0;
		gbc.gridy = 0;
		this.add(new CharShopPanel(gem,storeManager,settings,imgCache,statsFactory,charListModel), gbc);
	
		
	}

}
